<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/20
 * Time: 18:07
 */

namespace App\Http\Controllers\MiniProgramAdmin;


use App\Http\Traits\VipTrait;
use App\Http\Logics\MiniProgramAdmin\VipLogic;
use App\Http\Controllers\BaseController;
class VipController extends BaseController
{
    use VipTrait;
    /**
     * @SWG\Post(
     *     path="/vip/createByUserId",
     *     tags={"Vip"},
     *     description="赠送用户VIP",
     *     operationId="createVipByUserId",
     *     produces={"application/json", "application/xml", "text/xml", "text/html"},
     *     @SWG\Parameter(
     *         name="loginSession",
     *         in="query",
     *         description="验证秘钥",
     *         required=true,
     *         type="string"
     *     ),
     *     @SWG\Parameter(
     *         name="user_id",
     *         in="query",
     *         description="用户ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Parameter(
     *         name="vip_card_id",
     *         in="query",
     *         description="会员卡ID",
     *         required=true,
     *         type="integer",
     *         format="int32"
     *     ),
     *     @SWG\Response(
     *         response=200,
     *         description="pet response"
     *     )
     * )
     */
    public function createVipByUserId()
    {
        $loginSession = $this->loginSession;
        $vip_card_id = $this->vip_card_id;
        $user_id = $this->user_id;
        $data = [
            'loginSession' => $loginSession,
            'vip_card_id' => $vip_card_id,
            'user_id' => $user_id
        ];
        $response = VipLogic::createVipByUserId($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }
}